package com.guet.game.utils;

import sun.audio.AudioPlayer;
import sun.audio.AudioStream;

import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;

import static java.applet.Applet.newAudioClip;

public class Audio {
    private static final String folder = "/com/guet/resources/";

    InputStream is =null;
    AudioStream as = null ;

    public  Audio(String musicName){

        is = getClass().getResourceAsStream(folder+ musicName +".wav");
        try {
            as = new AudioStream(is);
        } catch (IOException e) {}

    }


    public void Play(){
        AudioPlayer.player.start(as);
    }

    public void Stop(){
        AudioPlayer.player.stop(as);
    }

}
